package practice;

import com.sun.source.tree.CatchTree;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class p007{
    public static void main(String[] args) {
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("F:\\untitled\\src\\practice\\temp001.txt");
            byte[] bytes = new byte[]{97,98,99,100};
            fos.write(bytes);
            fos.write(bytes,0,2);
            String s  ="我是中国人我骄傲！";
            byte[] bs  = s.getBytes();
            fos.write(bs);
            fos.flush();


        }
        catch (FileNotFoundException e ){
            e.printStackTrace();
        }
        catch (IOException e ){
            e.printStackTrace();
        }
        finally {
            if(fos != null){
                try {
                    fos.close();
                }
                catch (IOException e ){
                    e.printStackTrace();
                }
            }
        }
    }
}
